package org.demo.patten.memento;

/**
 * @author zhuj
 * @date 2025/3/29
 * @apiNote
 */
public class Editor {
    private String content;
    public void type(String words) {
        this.content = words;
    }
    public String getContent() {
        return content;
    }
    // 创建备忘录
    public EditorMemento save() {
        return new EditorMemento(content);
    }
    // 从备忘录恢复
    public void restore(EditorMemento memento) {
        this.content = memento.getContent();
    }
}
